package com.jk.controller;


import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.jk.feign.CouponService;
import com.jk.po.CouponPojo;
import com.jk.vo.ResultPageVo;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.ResponseBody;

@Controller
public class CouponController {
    @Autowired
    private CouponService couponService;
    @GetMapping("show")
    public String show(){
        return "show";
    }
    @GetMapping("index")
    public String index(){
        return "index";
    }
    @GetMapping("queryCouList")
    @ResponseBody
    public ResultPageVo queryCouList(){
        ResultPageVo resultPageVo = new ResultPageVo();
        IPage<CouponPojo> userBeanIPage =  couponService.queryCouList();
        resultPageVo.setTotal(userBeanIPage.getTotal());
        resultPageVo.setRows(userBeanIPage.getRecords());
        return resultPageVo;
    }

}
